package com.billdowney.util.properties;

import java.io.FileInputStream;
import java.io.FileOutputStream;

import com.billdowney.util.DateUtil;

public class Test {
	public static void xx(String[] args) throws Exception {
		String filePath = "E:\\TomcatFile\\system_params.properties";
		FileInputStream input = new FileInputStream(filePath);

		SafeProperties safeProp = new SafeProperties();

		safeProp.load(input, "UTF-8");

		input.close();

		//safeProp.put("aaa", DateUtil.getCurrentDate(), "更新：aaa，值：" + DateUtil.getCurrentDate() + "，时间：" + DateUtil.getCurrentDate());
		//safeProp.put("aaa", DateUtil.getCurrentDate());
		safeProp.putAndComment("aaa", DateUtil.getCurrentDate(), "更新：aaa，值：" + DateUtil.getCurrentDate() + "，时间：" + DateUtil.getCurrentDate());

		FileOutputStream output = new FileOutputStream(filePath);

		safeProp.store(output, null, "UTF-8");

		output.close();
	}
	
	public static void main(String[] args) throws Exception {
		String filePath = "E:\\TomcatFile\\system_params.properties";
		PropertiesFileUtil util = new PropertiesFileUtil(filePath);
		util.printAllKeyAndValue();
		System.out.println(util.getProperty("asdas"));
		System.out.println(util.getProperty("asdas").split("_\\|_")[0]);
		System.out.println(util.getProperty("asdas").split("_\\|_")[1]);
		System.out.println(util.getProperty("asdas").split("_\\|_").length);
//		System.out.println(util.getDouble("aa"));
//		util.put("DEVELOP_MODEL", "asdasd给哦接吻日 54");
//		util.put("time", System.currentTimeMillis() + "");
	}
}

